package pl.pawluk.inz.entities;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.sql.Timestamp;

/**
 * Created with IntelliJ IDEA.
 * User: mandp
 * Date: 17.05.13
 * Time: 19:39
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.IdClass(pl.pawluk.inz.entities.StudentLectureEntityPK.class)
@javax.persistence.Table(name = "student_lecture", schema = "public", catalog = "")
@Entity
public class StudentLectureEntity {
    private Long lectureId;

    @javax.persistence.Column(name = "lecture_id", nullable = false, insertable = true, updatable = true, length = 19, precision = 0)
    @Id
    public Long getLectureId() {
        return lectureId;
    }

    public void setLectureId(Long lectureId) {
        this.lectureId = lectureId;
    }

    private Long studentId;

    @javax.persistence.Column(name = "student_id", nullable = false, insertable = true, updatable = true, length = 19, precision = 0)
    @Id
    public Long getStudentId() {
        return studentId;
    }

    public void setStudentId(Long studentId) {
        this.studentId = studentId;
    }

    private Long subjectId;

    @javax.persistence.Column(name = "subject_id", nullable = false, insertable = true, updatable = true, length = 19, precision = 0)
    @Id
    public Long getSubjectId() {
        return subjectId;
    }

    public void setSubjectId(Long subjectId) {
        this.subjectId = subjectId;
    }

    private Timestamp signedTime;

    @javax.persistence.Column(name = "signed_time", nullable = false, insertable = true, updatable = true, length = 29, precision = 6)
    @Basic
    public Timestamp getSignedTime() {
        return signedTime;
    }

    public void setSignedTime(Timestamp signedTime) {
        this.signedTime = signedTime;
    }

    private Timestamp finishTime;

    @javax.persistence.Column(name = "finish_time", nullable = true, insertable = true, updatable = true, length = 29, precision = 6)
    @Basic
    public Timestamp getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(Timestamp finishTime) {
        this.finishTime = finishTime;
    }

    private Integer grade;

    @javax.persistence.Column(name = "grade", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public Integer getGrade() {
        return grade;
    }

    public void setGrade(Integer grade) {
        this.grade = grade;
    }

    private Boolean accepted;

    @javax.persistence.Column(name = "accepted", nullable = false, insertable = true, updatable = true, length = 1, precision = 0)
    @Basic
    public Boolean getAccepted() {
        return accepted;
    }

    public void setAccepted(Boolean accepted) {
        this.accepted = accepted;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        StudentLectureEntity that = (StudentLectureEntity) o;

        if (accepted != null ? !accepted.equals(that.accepted) : that.accepted != null) return false;
        if (finishTime != null ? !finishTime.equals(that.finishTime) : that.finishTime != null) return false;
        if (grade != null ? !grade.equals(that.grade) : that.grade != null) return false;
        if (lectureId != null ? !lectureId.equals(that.lectureId) : that.lectureId != null) return false;
        if (signedTime != null ? !signedTime.equals(that.signedTime) : that.signedTime != null) return false;
        if (studentId != null ? !studentId.equals(that.studentId) : that.studentId != null) return false;
        if (subjectId != null ? !subjectId.equals(that.subjectId) : that.subjectId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = lectureId != null ? lectureId.hashCode() : 0;
        result = 31 * result + (studentId != null ? studentId.hashCode() : 0);
        result = 31 * result + (subjectId != null ? subjectId.hashCode() : 0);
        result = 31 * result + (signedTime != null ? signedTime.hashCode() : 0);
        result = 31 * result + (finishTime != null ? finishTime.hashCode() : 0);
        result = 31 * result + (grade != null ? grade.hashCode() : 0);
        result = 31 * result + (accepted != null ? accepted.hashCode() : 0);
        return result;
    }
}
